<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    let game = {
        name: "绝地求生",
        price: 100,
        sale: function () {
            console.log(this.name + "打折了");
        }
    }

    // 给对象扩展方法：不确认对象的属性，但是确定对象的方法
    let methods = {
        up: Symbol(),
        down: Symbol()
    };
    game[methods.up] = function () {
        this.price += 10;
        console.log(this.name + "上调了");
    }
    game[methods.down] = function () {
        this.price -= 10;
        console.log(this.name + "下调了");
    }

    let youxi = {
        name: "王者荣耀",
        price: 100,
        [methods.up]() {
            this.price += 10;
            console.log(this.name + "上调了");
        },
        [methods.down]() {
            this.price -= 10;
            console.log(this.name + "下调了");
        }
    }

    youxi[methods.up]();
    game[methods.down]();










</script>

</html>